package com.collins.thread.practices.restaurant;

import java.util.Random;

public class Desk {

    public static final Object lock = new Object();
    // 0 is for consumer waiting
    // 1 is for producer waiting
    public static int flag = 0;
    // maximum product number
    public static int count = 10;
    // create one rng
    public static Random random = new Random();

    public static void main(String[] args) {

        Consumer consumerRunnable = new Consumer();

        Thread producer = new Thread(new Producer());
        Thread consumer1 = new Thread(consumerRunnable);
        Thread consumer2 = new Thread(consumerRunnable);
        Thread consumer3 = new Thread(consumerRunnable);
        producer.setName("producer");
        consumer1.setName("consumer1");
        consumer2.setName("consumer2");
        consumer3.setName("consumer3");

        producer.start();
        consumer1.start();
        consumer2.start();
        consumer3.start();
    }
}
